/*********************\
* Author:Dzlua
* QQ:505544956
* Time:2017/04/15
\**********************/
#include "LuaIPAddressEx.h"

#define CObjPtr ((CIPAddressExUI*)m_cobj)

namespace DuiLib {

UINT LuaIPAddressEx::GetControlFlags()
{
    return CObjPtr->GetControlFlags();
}

int LuaIPAddressEx::SetIP(LuaState *L)
{
    LuaStack args(L);
    if (args[2].IsWString()) {
        CObjPtr->SetIP((LPCWSTR)args[2].GetWString());
    }
    return 0;
}

int LuaIPAddressEx::GetIP(LuaState *L)
{
    SDTString str = CObjPtr->GetIP().GetData();
    LuaHelperNS::PushTString(L, str.c_str());
    return 1;
}

SDLUA_BEGIN_REGISTER(LuaIPAddressEx, IPAddressEx, Edit)
    SDLUA_REGISTER_FUN_CPP(LuaIPAddressEx, GetControlFlags, GetControlFlags)
    SDLUA_REGISTER_FUN_LUA(LuaIPAddressEx, SetIP, SetIP)
    SDLUA_REGISTER_FUN_LUA(LuaIPAddressEx, GetIP, GetIP)
SDLUA_END_REGISTER

SDLUA_BEGIN_UNREGISTER(LuaIPAddressEx, IPAddressEx)
SDLUA_END_UNREGISTER(IPAddressEx)

}

#undef CObjPtr